﻿//03.Write a program that reads from the console a sequence of N 
//numbers and returns the minimal and maximal of them.

using System;

namespace MinVSMax
{
    class MinVSMax
    {
        static void Main()
        {
            Console.Write("How many do you want to compare: ");
            int n = int.Parse(Console.ReadLine());

            if (n <= 0)
            {
                Console.WriteLine("Enter a positive number!");
            }
            else
            {
                int number, min, max;

                Console.Write("Enter a number: ");
                number = int.Parse(Console.ReadLine());

                min = max = number;

                for (int i = 1; i < n; i++)
                {
                    Console.Write("Enter a number: ");
                    number = int.Parse(Console.ReadLine());
                    if (max < number)
                    {
                        max = number;
                    }
                    if (min > number)
                    {
                        min = number;
                    }
                }
                Console.WriteLine("The min number is {0}.", min);
                Console.WriteLine("The max number is {0}.", max);
            }
        }
    }
}
